import type { SuperTableInstance } from '../typing';
import { provide, inject } from 'vue';
import type {ComponentInternalInstance } from 'vue';

const key = Symbol('super-table');

export function createTableContext(instance: ComponentInternalInstance) {
  provide(key, instance.proxy);
}

export function useTableContext() {
  return inject(key) as SuperTableInstance;
}
